package com.hmob.hmdemo;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;

import com.hmob.hmsdk.ads.AdError;
import com.hmob.hmsdk.ads.floating.FloatingListener;
import com.hmob.hmsdk.ads.floating.HMFloating;

public class FloatingActivity extends AppCompatActivity {
    private HMFloating hmFloating;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_floating);
    }

    @Override
    protected void onResume() {
        super.onResume();
        hmFloating = new HMFloating(this, Constants.ADID_FLOATING, 60, 5, new FloatingListener() {
            @Override
            public void onNoAD(AdError adError) {
                Log.e("FloatingActivity", adError.getErrorMessage());
            }

            @Override
            public void onADReceived() {
                Log.i("FloatingActivity", "onADReceived");
            }

            @Override
            public void onADExposure() {
                Log.i("FloatingActivity", "onADExposure");
            }

            @Override
            public void onADClicked() {
                Log.i("FloatingActivity", "onADClicked");
            }

        });
        hmFloating.setRefresh(10);
        hmFloating.load();
    }

    @Override
    protected void onStop() {
        super.onStop();
        hmFloating.onDestroy();
    }
}
